var vm = new Vue({
	el: '#app',
	data: {
		number: 2,
		index: 0,
		imgs: [
			"../../assets/img/00a29e793e3369ec107370bb9dcee123.jpg",
			"../../assets/img/00b1d854477fdf493124026ebbc35012.jpg",
			"../../assets/img/0a7497f07fce1139ccd0d939dbbdc374.jpg",
			"../../assets/img/0aa713b899691e73545c401f23917f67.jpg",
			"../../assets/img/00d475bb17ba5c23dbdb9ed49ab4b847.jpg",
			"../../assets/img/0a180298065a92542b8894a179b79165.jpg",
			"../../assets/img/0a282cc4f87d61b4d6f0d4c29bc1fd75.jpg",
			"../../assets/img/0a8c61b14f6d3606d7789f12959f8a6b.jpg",
			"../../assets/img/00d74fee8c7cabc23f2e4dde4e23e40d.jpg",
			"../../assets/img/00a088c60e5a6f30fc7a34fa489ff715.jpg"

		]
	},
	methods: {
		subtract: function() {
			if (this.number <= 0) {
				alert('数量不少于0！');
				return;
			}
			this.number--;

		},
		add: function() {
			if (this.number >= 10) {
				alert('库存不足！');
				return;
			}
			this.number++;
		},
		prep: function() {
			if (this.index <= 0) {
				this.index = this.imgs.length - 1;
			}
			this.index--;

		},
		next: function() {
			if (this.index >= this.imgs.length) {
				this.index = 0;
				return;
			}
			this.index++;
		}
	}
})
